# MainWindow - conedit's main window class
# January 23, 2013
# created by Adlertag L.L.C.
# licensed under the GPL v3

from PyQt4 import (QtGui,  QtCore)

class MainWindow(QtGui.QMainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        settings=QtCore.QSettings()
        size=settings.value("MainWindow/Size", QtCore.QVariant(QtCore.QSize(800, 600))).toSize()
        self.resize(size)
        position=settings.value("MainWindow/Position", QtCore.QVariant(QtCore.QPoint(0, 0))).toPoint()
        self.move(position)
        self.restoreState(settings.value("MainWindow/State".toByteArray()))
        self.setWindowTitle("AS Config Editor - version 0.0.1")

    def closeEvent(self, event):
        if self.okToContinue():
            settings=QtCore.QSettings()
            settings.setValue("MainWindow/Size", QtCore.QVariant(self.size()))
            settings.setValue("MainWindoe/Position", QtCore.QVariant(self.pos()))
            settings.setValue("MainWindow/State", QtCore.QVariant(self.saveState()))
        else:
            event.ignore()
            
